package com.cch.demo.sys.service.impl;

import java.util.List;
import org.springframework.stereotype.Service;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cch.demo.sys.domain.User;
import com.cch.demo.sys.mapper.UserMapper;
import com.cch.demo.sys.service.UserService;


@Service
@DS("master")
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

//    @Override
//    @DS("master")//这里必须包一层，不能调用mp默认的插入，因为会走到从库去
//    public void addUser(User user) {
//        baseMapper.insert(user);
//    }
    
    @Override
    @DS("test2")
    public List<User> selectList(Wrapper<User> queryWrapper) {
    	// TODO Auto-generated method stub
    	return baseMapper.selectList(queryWrapper);
    }
    
    @DS("#name")
    public List<User> list(Wrapper<User> queryWrapper,String name) {
    	System.out.println(name);
    	return baseMapper.selectList(queryWrapper);
    }
    
//    @DS("#name")
//    @Transactional
//    @GlobalTransactional
//    public boolean addUser(String name,User user) {
//    	return super.save(user);
//    }

}
